package com.cityeye.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.cityeye.dao.AbstractEntityDao;
import com.cityeye.dao.IssueTypeDao;
import com.cityeye.dao.SubissuetypeDao;
import com.cityeye.entity.Issuetype;
import com.cityeye.entity.Subissuetype;
import com.cityeye.util.QryKeys;

public class SubIssueTypeAction extends AbsListPageAction<Subissuetype> {

	public ActionForward query(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward forward = super.query(mapping, form, request, response);
		IssueTypeDao dao = new IssueTypeDao();
		List<Issuetype> issueTypes = dao.query(-1, -1,
				new HashMap<String, Object>());
		request.setAttribute("issueTypes", issueTypes);
		return forward;
	}

	/**
	 * Map of Session stored name:entity property name.
	 * 
	 * @return
	 */
	protected Map<String, String> getSessionQueries() {
		HashMap<String, String> queries = new HashMap<String, String>();
		queries.put(QryKeys.SUBISSUE_PA_ISSUETYPE, "issuetype");
		return queries;
	}

	protected AbstractEntityDao<Subissuetype> getEntityDao() {
		return new SubissuetypeDao();
	}
}
